import { Field, ID, ObjectType } from '@nestjs/graphql';
import { SharedEntity } from 'src/modules/shared/entities/shared.entity';
import { Entity, Column, DeleteDateColumn, UpdateDateColumn, CreateDateColumn, PrimaryGeneratedColumn } from 'typeorm';
import { RoleEntity } from '../../role/entities/role.entity';

@ObjectType()
@Entity('account')
export class AccountEntity extends SharedEntity{
  @Field()
  @Column({
    type: 'varchar',
    length: 50,
    name: 'username',
    comment: '用户名',
  })
  username: string;

  @Field()
  @Column({
    type: 'varchar',
    length: 100,
    name: 'password',
    comment: '密码',
  })
  password: string;

  // 扩展一个角色数据
  @Field(type => [RoleEntity!]!, {nullable: true, description: '角色列表'})
  roleList: RoleEntity[];
}